package com.cwj.innerclass;

/**
 * @author wujie.chen
 * 2021/12/9 10:59
 */
public class InnerClassTest {
    private int n;
    private class B {
        public void print(){
            System.out.println(n);
        }
    }
    public void m(int m){
        //Variable used in lambda expression should be final or effectively final
        A a = () -> {
            System.out.println(m);
            System.out.println(n);
        };
        new Thread(){
            @Override
            public void run() {
                // Variable 'm' is accessed from within inner class, needs to be final or effectively final
//                m = 3;
                System.out.println(m);
            }
        };
    }

    public static void main(String[] args) {
        InnerClassTest innerClassTest = new InnerClassTest();
        B b = innerClassTest.new B();
        b.print();


    }


}
interface A{
    void something();
}
